var login = {
	
	initSignForm:function(){

		var options = {
            dataType : 'json',
            beforeSerialize : function(form, options) {
                options.url = 'account/login.json';
            },
            beforeSubmit : function() {
            	if(!$('#name').val()){
            		$('#inputNull').html("用户名为空！");
                	return false;
                }
                if(!$('#password').val()){
                	$('#inputNull').html("密码为空！");
                    return false;
                }
            	
                $('#signForm').attr('action', 'http://localhost:8080/JoyniProjectManage/account/login.json');
                return true;
            },
            success : function(data) {
                if(data.result=='success'){ 
                    location.href = data.redirectURL;
                }else{
                	$('#inputNull').html("用户名或密码错误！");
                }
            }
        };
        
        $('#signForm').submit(function() {
            $(this).ajaxSubmit(options);
            return false;
        });
	}
};